/*=+--+=#=+--     Unmanned Aerial System Management Software      --+=#=+--+=#*\
|          Copyright (C) 2011 Regents of the University of Colorado.           |
|                             All Rights Reserved.                             |

     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2 as
     published by the Free Software Foundation.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.

            Jack Elston                       Cory Dixon                        
|           elstonj@colorado.edu              dixonc@colorado.edu              |
|                                                                              |
\*=+--+=#=+--                 --+=#=+--+=#=+--                    --+=#=+--+=#*/

#ifndef __TARGET_LAYER_MANAGER_H
#define __TARGET_LAYER_MANAGER_H

#define NUM_TARGETS 255

#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <string>

#include "LayerManager.h"

/*<-------Defines--------->*/
/*<------End Defines------>*/

//------- Structs ---------//

typedef struct {
	bool exists;
	GPSTelem_t telemetry;

	GooCanvasItem  *item;
	GooCanvasItem  *icon;
	double         img_x;
	double         img_y;
	bool        targeted;

} TargetType_t;

class TargetManager : public LayerManager
{
	private:
		TargetType_t targets[NUM_TARGETS];
		int numTargets;

		void create_icon(TargetType_t *target, int number);
		void update_icon(int number);

		GooCanvasItem *target_layer;
		bool resetFromZoom;

		void set_check_butons();

		bool canvas_created;

	public:
		TargetManager();
		~TargetManager();

		// layer interface
		virtual void init(GPSMap *map = NULL);
		virtual void updateMap();
		virtual void translate_from_zoomChange(double zoom_factor);
		virtual bool setShown(int setTo = -1);

		// canas setup
		void create_canvas();
		bool received_data(int clientInd, uint8_t * buf);
};

#endif
